Getting the Most from the Liberty BASIC IDE

Adding Custom Tools!

by Alyce Watson [http://alycesrestaurant.com/]

Home

Container Control

API Dialogs

Place a Dialog

Center a Dialog

LB IDE

Close Multiple Windows

TransparentBlt

Animation Control

Sprite Byte

Qcard DLL

Patterns and Music

Newsletter help

Index


What is an IDE?

IDE stands for "Integrated Development Environment." The Liberty BASIC editor is more than just a code editor, and you can customize the way it works to make your coding time faster and easier.

CUSTOM TOOLS!

Did you know that you can run your own TKN files from the RUN menu by specifying them in the "Run Externals" dialog? You can extend the IDE in many ways by creating your own tools. You can create a mask-maker for sprites, a bitmap previewer, a snippet manager, etc. etc. and add these tools to the RUN menu. You can use tools that have already been provided by other LB programmers, like the API Converter by Colin McMurchie that was featured in issue #119.

RUN EXTERNALS

The "Setup" menu has an option to "Run Externals." Add often-used externals to this menu in the "Setup External Programs" dialog, by giving them a title and specifying the path to the EXE, TKN or BAT file. When Notepad is set up to run, loaded with the error.log file, the dialog looks like this:

To add a new program to the externals menu, click the "New" button. You'll see this dialog:

Once you've given your program a name that will show in the "Run" menu, you must type the filename into the textbox in the dialog.

Add a custom tool.

You can easily add a sprite mask-maker. Look in the Liberty BASIC helpfile for the sprite topic, "Add a Mask." Copy the code into the LB editor and run it to be sure that it works correctly. Tokenize the code by selecting "Make *.TKN File" from the "Run" menu. Give it the name "masker.tkn".

Next, click the "External Programs" item in the "Setup" menu. Choose to add a new program. You'll see a dialog like the following one. Give the program a name like the one here:

All that is left is to type in the filename of the TKN file:

Fonts

You can change the font displayed in the editor window by going to the "Setup" menu, or by clicking the setup button on the toolbar, then choose "Editor Font" to select the desired font. Select "Printer Font" to change the font used by the printer to print hard copies of code. Select the font desired in the dialog, and it will become the default font for the editor or printer. If you want the code to line up nicely, select a font such as "Courier New" in which all characters are the same width.

You can also have syntax coloring in the code editor. If this option is selected, comments, variables, strings, branch labels, and commands are displayed in unique colors. Some people find this distracting, while others think it makes the code easier to read. The choice is yours! There is no way to customize the colors used.

Preferences

You may customize many aspects of the way the LB editor works. Change your preferences by opening the "Preferences" dialog, accessed from the "Setup" menu. You can choose to have a "confirm on exit" notice when exiting Liberty BASIC. You can also have an "execution complete" notice when an LB program ends. It is a good idea to activate the "Add 'Kill BASIC Apps' to all Windows" function. If a program locks up, it can often be closed by choosing "Kill BASIC Programs" from the "Run" menu. You can choose to start the Liberty BASIC editor full screen, and to show a progress bar while code is compiling to run or debug. The "Create BAK" feature automatically creates a copy of your code, and saves it with the extension BAK any time a program is run or debugged. This insures that the current state of the program code is saved, in case the program crashes and ends LB without giving you a chance to save your code. You can specify a default directory where backup files are saved, and even a default extension for LB files.

OPEN FILE ON STARTUP

There is an option to "Open this file on startup." This feature is activated by default when Liberty BASIC is installed, and the "welcome.bas" code is automatically loaded into the editor. If this option is unchecked, then no code will load automatically when Liberty BASIC begins. You can specify the file to open, or you can choose to open the most recently opened file on startup.

MAINWINDOW SIZE

The Setup Preferences dialog also includes values for the number of rows of text, and columns (number of characters) that are displayed by default in the mainwindow. This sets the default size of the mainwindow.

COMPILE STATUS

The Liberty BASIC editor also includes a status bar at the bottom of the window, which reports on the status of program compilation.

COMPILER REPORTING

If you select the option for compiler reporting, Liberty BASIC checks variable names for similarities when the program is compiled for running or debugging. If it finds similar variable names, it opens a reporting pane at the bottom of the editor window with a list of similar variables. This can be very helpful in finding errors in typing that cause problems when a program executes.

For example, if a program has two variable names which are the same except for their capitalization, the reporter finds this. Here is an example:

numItems = 20
NumItems = 30

Running a program containing the lines above anywhere in the code causes the compiler reporting pane to appear at the bottom of the Liberty BASIC editor. It reports:

similar variables: numItems, NumItems

If a program has variables whose spelling differs only slightly, the reporter will mention it.

game$ = "Checkers"
games$ = "Chess" 

If the lines above are contained in a program, the compiler reports:

similar variables: game$, games$

You can hide the compiler reporting pane by right-clicking the mouse in it and choosing "Hide" from the menu.

CHANGING SETUP PREFERENCES

Liberty BASIC reads the LBASICxxx.INI file when it starts. This file is in the same directory that contains Liberty.exe. The INI file stores your preferences. The runtime engine uses some of the information in this file (if it finds the file on startup).


Home

Container Control

API Dialogs

Place a Dialog

Center a Dialog

LB IDE

Close Multiple Windows

TransparentBlt

Animation Control

Sprite Byte

Qcard DLL

Patterns and Music

Newsletter help

Index